package kr.ac.mlb.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kr.ac.mlb.action.MainAction;
import kr.ac.mlb.action.WriteAction;
import kr.ac.mlb.action.ListAction;
import kr.ac.mlb.mvc.Action;


@WebServlet("/write")
public class WriteServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String a = request.getParameter("a");

		Action action = null;

		if("add".equals(a)){
			action = new WriteAction();
//			System.out.println("addaction");
		}else{
			action = new MainAction();
		}

		action.execute(request, response);
	}

}
